﻿using LaserMark.DataAccess.Models;

namespace LaserMark.DataAccess.Service
{
    public class DeviceArgsService : IDeviceArgsService
    {
        private IDBManager DBManager { get; set; }

        public DeviceArgsService(IDBManager dBManager)
        {
            DBManager = dBManager;
        }

        public async Task<IEnumerable<DeviceArgs>> RetriveAll()
        {
            using var db = DBManager.Create();
            return await db.FetchAsync<DeviceArgs>();
        }

        public async Task<DeviceArgs> GetDeviceArgsByKey(string key)
        {
            using var db = DBManager.Create();
            return await db.SingleAsync<DeviceArgs>("where Key = @0", key);
        }

        public Task<bool> UpdateById(int id)
        {
            return Task.FromResult(true);
        }
    }
}
